package com.prs.crm.domain.flow;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.prs.crm.domain.BaseEntity;

@Entity
@Table(name="flow_flow")
public class WorkFlow  extends BaseEntity{

	private static final long serialVersionUID = -9118715718702961720L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String name;
	
	private Integer type;
	
	private Integer state;
	
//	private String flowState;  //流程状态:启用、停用
//	private String updatePerson;  //允许修改人员
//	private String userPerson;   //允许使用人员
//	private String upadeflow;  //允许申请人修改审批流程
//	private String uplod;  //允许申请人上传附件
	
	@Lob
	private String remark;
	
	@OrderBy("sequence asc")
	@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy="flow")
	private Set<WorkFlowNode> nodes;
	@OrderBy()
	@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.LAZY,mappedBy="flow")
	private Set<WorkFlowTransition> transitions;
	@ManyToOne
	private WorkFlowType workFlowType;
	public WorkFlowType getWorkFlowType() {
		return workFlowType;
	}
	public void setWorkFlowType(WorkFlowType workFlowType) {
		this.workFlowType = workFlowType;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public Integer getType() {
		return type;
	}
	public void setState(Integer state) {
		this.state = state;
	}
	public Integer getState() {
		return state;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getRemark() {
		return remark;
	}
	public void setNodes(Set<WorkFlowNode> nodes) {
		this.nodes = nodes;
	}
	public Set<WorkFlowNode> getNodes() {
		return nodes;
	}
	public void setTransitions(Set<WorkFlowTransition> transitions) {
		this.transitions = transitions;
	}
	public Set<WorkFlowTransition> getTransitions() {
		return transitions;
	}
	
}
